package org.jeecg.common.baidu;

import com.baidu.aip.imageclassify.AipImageClassify;
import org.jeecg.common.wx.Const;
import org.json.JSONObject;

import java.util.HashMap;

public class Demo {

    public static void main(String[] args) {
        // 初始化一个AipImageClassify
        AipImageClassify client = new AipImageClassify(Const.BAIDUAPPID, Const.BAIDUAPIKEY, Const.BAIDUSECRET);

        // 可选：设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);

        // 调用接口
        String path = "/usr/order.jpg";
        JSONObject res = client.objectDetect(path, new HashMap<String, String>());
//        System.out.println(res.toString(2));


        HashMap<String, String> options = new HashMap<String, String>();
        options.put("baike_num", "5");


        // 参数为本地路径
        String image ="/usr/order.jpg";
        JSONObject res1 = client.advancedGeneral(image, options);
        System.out.println(res1.toString(2));

    }





}
